package com.gragra.dependencyParsing.tests;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import org.junit.Before;
import org.junit.Test;
import com.gragra.dependencyParsing.DMVModel;
import com.gragra.dependencyParsing.DisHeadModel;
import com.gragra.parseOptions.CommandLineException;
import com.gragra.parseOptions.Parser;
public class TestDMVModel
{
	/**
	 * 
	 */
	private DisHeadModel dmv;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception
	{dmv = new DMVModel();}
	/**
	 * Test method for {@link com.gragra.dependencyParsing.SimpleDMV#addParameters(com.gragra.parseOptions.Parser)}.
	 * @throws CommandLineException 
	 * @throws IOException 
	 * @throws InterruptedException 
	 */
	@Test
	public void testAddParameters() throws CommandLineException, IOException, InterruptedException
	{
		Parser pa = new Parser();
		dmv.addParameters(pa);
		ObjectArrayList<String> oal = new ObjectArrayList<String>();
		System.out.println(pa.writeOutHelp());
		oal.add("Greedy");
		pa.setOption("sampType", oal);
		oal.clear();
		oal.add("0.05");
		pa.setOption("hAlpha", oal);
		oal.set(0, "0.02");
		pa.setOption("proposalS", oal);
		oal.set(0, "5");
		pa.setOption("chains", oal);
		oal.set(0, "2");
		pa.setOption("interSteps",oal);
		oal.set(0, "20");
		pa.setOption("sampSteps", oal);
		oal.set(0, "0.5");
		pa.setOption("annStepSize", oal);
		oal.set(0, "1.0");
		pa.setOption("annMin", oal);
		oal.set(0, "20");
		pa.setOption("burnIn", oal);
		oal.set(0, "2.0");
		pa.setOption("annMax", oal);
		oal.set(0, "0.9");
		pa.setOption("dAlpha", oal);
		oal.set(0, "0.1");
		pa.setOption("fAlpha", oal);
		oal.set(0, "5.0");
		pa.setOption("stAnnMax",oal);
		oal.set(0, "0.5");
		pa.setOption("stAnnStep",oal);
		StringReader sr = new StringReader("That|DT man|NN is|V the|DT principal|NN\nHis|DT friend|NN met|V a|DT king|NN\nThe|DT author|NN wrote|V\n" +
				"He|PR stopped|V\nHe|PR saw|V the|DT author|NN");
		BufferedReader br = new BufferedReader(sr);
		StringWriter sw1 = new StringWriter();
		BufferedWriter samp = new BufferedWriter(sw1);
		StringWriter sw2 = new StringWriter();
		BufferedWriter best = new BufferedWriter(sw2);
		dmv.makeParses(pa, br, samp, best);
		br.close();
		samp.close();
		best.close();
	}
}